package com.shen.cloud.controller;

import com.shen.cloud.pojo.Department;
import com.shen.cloud.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class DepartmentController {
    @Autowired
    DepartmentService departmentService;

    @PostMapping("/dept/add")
    public boolean insertDepartment(Department department){
        return departmentService.insertDepartment(department);
    }
    @GetMapping("/dept/get/{id}")
    public Department selectDepartmentById(@PathVariable("id") Long id, Department department){
        return departmentService.selectDepartmentById(id);
    }
    @GetMapping("/dept/list")
    public List<Department> selectAllDepartment(){
        return departmentService.selectAllDepartment();
    }
}
